/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rbh.risk.managedbean.backend;

import com.rbh.risk.entity.Opduser;
import com.rbh.risk.entity.Role;
import com.rbh.risk.entity.Workgroup;
import com.rbh.risk.service.ProfileService;
import com.rbh.risk.service.RoleService;
import com.rbh.risk.service.WorkgroupService;
import java.io.Serializable;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;

@ManagedBean(name = "profileSettingManageBean")
@RequestScoped
public class ProfileSettingManagedBean implements Serializable {

    private static final long serialVersionUID = 1L;
    
    /* Selected Object */
    @ManagedProperty(value = "#{selectedOpduser}")
    private Opduser selectedOpduser;
    @ManagedProperty(value = "#{selectedRole}")
    private Role selectedRole;
    @ManagedProperty(value = "#{selectedWorkgroupList}")
    private List<Workgroup> selectedWorkgroupList;
    
    /* List Object For View */
    @ManagedProperty(value = "#{roleList}")
    private List<Role> roleList;
    @ManagedProperty(value = "#{workgroupList}")
    private List<Workgroup> workgroupList;
    
    /* Business Model */
    @ManagedProperty(value = "#{roleService}")
    private RoleService roleService;
    @ManagedProperty(value = "#{profileService}")
    private ProfileService profileService;
    @ManagedProperty(value = "#{workgroupService}")
    private WorkgroupService workgroupService;
    
    public ProfileSettingManagedBean(){
    }
    
    /*
     * Method For AutoComplete
     */
    public List<Opduser> completeLoginname(String words) {
        List<Opduser> results = null;
        try{
            results = profileService.getByWordOfOpduser(words);
        } catch (Exception ex){
            ex.printStackTrace();
        }
        return results;
    }

    public Opduser getSelectedOpduser() {
        return selectedOpduser;
    }

    public void setSelectedOpduser(Opduser selectedOpduser) {
        this.selectedOpduser = selectedOpduser;
    }

    public Role getSelectedRole() {
        return selectedRole;
    }

    public void setSelectedRole(Role selectedRole) {
        this.selectedRole = selectedRole;
    }

    public List<Workgroup> getSelectedWorkgroupList() {
        return selectedWorkgroupList;
    }

    public void setSelectedWorkgroupList(List<Workgroup> selectedWorkgroupList) {
        this.selectedWorkgroupList = selectedWorkgroupList;
    }

    public List<Role> getRoleList() {
        return roleList;
    }

    public void setRoleList(List<Role> roleList) {
        this.roleList = roleList;
    }

    public List<Workgroup> getWorkgroupList() {
        return workgroupList;
    }

    public void setWorkgroupList(List<Workgroup> workgroupList) {
        this.workgroupList = workgroupList;
    }

    public RoleService getRoleService() {
        return roleService;
    }

    public void setRoleService(RoleService roleService) {
        this.roleService = roleService;
    }

    public ProfileService getProfileService() {
        return profileService;
    }

    public void setProfileService(ProfileService profileService) {
        this.profileService = profileService;
    }

    public WorkgroupService getWorkgroupService() {
        return workgroupService;
    }

    public void setWorkgroupService(WorkgroupService workgroupService) {
        this.workgroupService = workgroupService;
    }
    
}